1. Field of the Invention
This invention relates generally to methods and apparatus for transferring data. In particular, the present invention relates to methods and apparatus for efficiently passing I/O transaction messages and their associated data between a host device and a target device.
2. Description of the Related Art
Even though a host device such as a conventional server may perform optimally, the data transfer performance of the server can be less than optimum because of the manner in which the input/output (I/O) subsystem of the server transfers data blocks to and from a connected network. For example, the transferred data may vary greatly from large prerecorded contiguous blocks of image data, such as multimedia data from a CD-ROM, to much smaller heavily fragmented user data. In local area networks (LANs), about 80% of the LAN packets are less than 200 bytes in length. Despite the prevalence of small data blocks, about 80% of the total amount of data is carried in maximum size LAN packets, which range anywhere from 1500 bytes to over 64000 bytes depending on the LAN technology.
A host device can transfer a data block to a target device by pushing it out to the target device all at once. An advantage of this xe2x80x9cpushxe2x80x9d method is that the I/O driver in the host device can be simple since it does not have to interact with the target device and can push out the data block as soon as it is able. The push model works well with small data blocks that can be easily buffered in the I/O controller of the target device. However, the number and size of buffers in the I/O controller of the target device must be large enough to handle the biggest possible data blocks. If the biggest possible data block can be 1 or 2 megabytes for example, a problem exists in that a corresponding 1 or 2 megabyte buffer memory has to be provided within the target device. See FIG. 1. Such an excessive memory requirement is not cost effective. Accordingly, the push model is not feasible in many circumstances.
If each transferred data block is limited to some predetermined size, e.g., 2 kilobytes, then the buffer(s) in the target device can have a correspondingly limited size. See FIG. 2. The problem with such an arrangement is that the limitation in block transmission size requires large blocks of data to be sliced into smaller network packets, with a header identifier attached to each of the smaller network packets. The smaller network packets are repeatedly sent until all of the data block has been transferred. This solution increases the number of data transfers, the amount of data being transmitted across the network, is fixed to the size of the buffer, and also represents significant record-keeping problems since the bytes of the packets typically come from fragmented data blocks.
As an alternative to the push model, the I/O controller of the target device can process a script and pull the data from memory in the host device by continuously reading a command list according to the script. As an example, suppose the host device wishes to transfer a block of data out to a local area network over a network interface controller (NIC). The host device first stores the data block in internal memory and sends a message alerting the NIC of the output command. The NIC must decipher the message and then read host memory to obtain the address of the output command block. It must also read a pointer, which is the value representing an address within the host memory where the data associated with the output command can be found. (The pointer may be virtual or physical and the location of the data is not necessarily contiguous with the location of the command. Indeed, the data may be split, requiring a Scatter/Gather List (SGL) to describe the locations of the data.) The NIC then goes to the address of host memory pointed to by the pointer. The block of data is read from the host memory back to the NIC, which will require several more fetches. The data is then subsequently transferred from the NIC to the network. Even if the host sets aside known areas for the command blocks in memory so that the NIC always knows the address of the command block, the NIC would still need to read the write command to know where the data is located and to perform the fetches to obtain the data.
Such a conventional data transfer procedure (illustrated generally in FIG. 3) of loading data in local memory and sending a command with pointer (step 1), waiting for and receiving a request for the data (step 2) and subsequently sending the data in response to the request (step 3) has substantial inherent latencies and delays. The procedure is very inefficient and slows down the entire system since many processor cycles will pass before the data transfer is completed. The latency incurred when transferring data to a network from a host device in this manner can greatly diminish the performance of the target device since it is usually unable to engage in other operations until the data transfer is complete. This latency is longer and even more complicated when the host device is a server because there is so much competition for server resources including system memory, processor(s) and multiple I/O devices. Indeed, the lack of efficiency in transferring data blocks may have a larger effect on overall performance than the processor speed or other performance characteristics of the host device and other elements in the network. In particular, the buses and/or controller in the I/O subsystem connecting the host device to the network may be a bottleneck in transferring data over the network and the performance of the I/O subsystem needs to be improved.
The present invention is directed to the transfer of data between a host device and a target device. A data transfer method adaptively transfers data from the host device to the target device across a channel-based interconnect. The method includes determining whether or not the size of the data to be transferred is greater than the maximum payload of a cell for the channel-based interconnect. If the size of the data to be transferred is not greater than the maximum payload, then a single cell is transferred from the host device to the target device which includes all of the data. If the size of the data to be transferred is greater than the maximum payload, then a request message is transferred from the host device to the target device. The request message includes a portion of said data to be transferred and control information indicating that not all of the data to be transferred is included in the request message. The target device transfers the remainder of the data from the host at the same time it starts processing the data in the request.